{% extends "_layout.html" %}
{% import "component/statistics.njk" as statistics %}

{# 样式代码 #}
{% block style %}
<title>假条详情</title>
<style type="text/css">
    .mb-post-list-3{ padding: 0;}
</style>
{% endblock %}

{# bodyd代码#}
{% block body %}
<div class="mui-content">
    <!--&lt;!&ndash;审批人&ndash;&gt;-->
    <!--<div class="bbs-user-top xw-border-bottom">-->
        <!--<a class="bbs-user-info mui-clearfix" href="#">-->
            <!--<img class="bbs-user-photo mui-pull-left" src="images/user2.png"/>-->
            <!--<div class="mb-nick-name mui-pull-left">-->
                <!--<b class="mb-nickname mui-ellipsis">陈校长</b>-->
                <!--<p class="mb-arr-time"><span>审批通过</span></p>-->
            <!--</div>-->
        <!--</a>-->
    <!--</div>-->
    <!--帖子循环主体开始-->
    <div class="mb-post-list-3">
        <ul class="mui-table-view">
            <li class="mui-table-view-cell leave-left">
                任职班级
                <span class="leave-item">三年2班</span>
            </li>
            <li class="mui-table-view-cell leave-left">
                任职科目
                <span class="leave-item">语文</span>
            </li>
            <li class="mui-table-view-cell leave-left">
                请假类型
                <span id="dataid" class="leave-item" data-id="{{data.id}}">
                    {%if data.type == 1%}
                        年假
                    {%elif data.type == 2%}
                        事假
                    {%elif data.type == 3%}
                        病假
                    {%elif data.type == 4%}
                        调休
                    {%elif data.type == 5%}
                        陪产假
                    {%elif data.type == 6%}
                        婚假
                    {%elif data.type == 7%}
                        例假
                    {%elif data.type == 8%}
                        丧假
                    {%else%}
                        其他
                    {%endif%}
                </span>
            </li>
            <li class="mui-table-view-cell leave-left">
                开始时间
                <span class="leave-item">{{data.createDate}}</span>
            </li>
            <li class="mui-table-view-cell leave-left">
                结束时间
                <span class="leave-item">{{data.endDate}}</span>
            </li>
            <li class="mui-table-view-cell leave-left">
                请假事由
                <span class="leave-item">{{data.content}}</span>
            </li>
        </ul>

        <ul class="mui-table-view leave-his">
            <li class="mui-table-view-cell leave-left">
                <a class="leave-lists mui-navigate-right" href="leavelist"
                   data-id="{{data.id}}" data-type="{{data.type}}"
                    data-startDate="{{data.startDate}}" data-startPart="{{data.startPart}}"
                    data-endDate="{{data.endDate}}" data-endPart="{{data.endPart}}"
                    data-content="{{data.content}}">我的请假记录</a>
            </li>
        </ul>
    </div>
</div>

<nav class="mui-bar mui-bar-tab">
    <a class="mui-tab-item1 xw-border-right">
        <span class="mui-tab-label">修改</span>
    </a>
    <a class="mui-tab-item1" href="javascript:;">
        <span class="mui-tab-label">撤销</span>
    </a>
</nav>
{% endblock %}

{#js代码#}
{% block js %}
<script src="js/jquery-2.1.1.min.js"></script>
<script>
    $('nav a:eq(0)').on('click',function(){
        window.location.replace("leave?id={{data.id}}&type={{data.type}}&sd={{data.startDate}}&sp={{data.startPart}}&ed={{data.endDate}}&ep={{data.endPart}}&content="+encodeURI(encodeURI("{{data.content}}")));
    })

    $('nav a:eq(1)').on('click',function(){
        console.log($('#dataid').data('id'));
        mui.post('/delleave', {
            leaveId:$('#dataid').data('id'),
            },function(data){
                if(data.code!=200){
                    mui.toast('删除失败');
                }else{
                    mui.toast('删除成功');
                    window.location.replace('/leave');
                }
            },'json'
        );
    })
</script>
<!--flotdemo-->
{% endblock %}
